/**
 * @author: 小佘佘🦀
 * @description: 登录接口
 * @param {string} email
 * @param {string} password
 * 
 * */ 

export const login = async (email: string, password: string) => {

    const params = new URLSearchParams()
    params.append("email", email)
    params.append("password", password)

    const response = await fetch(`/api-backend/login`, {
        method: "post",
        headers: {
            "Content-Type": "application/x-www-form-urlencoded",
        },
        mode: "no-cors",
        body: params.toString(),
        redirect: "manual" 
    })

    if (response.ok) {
        const data = await response.json()
        return data
    }
}